package com.tangkuo.study.rpc.netty;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;

/**
 * 后续处理handdler
 * 
 * @author 
 *
 */
public class XHandller extends ChannelInboundHandlerAdapter {
	private final  Logger logger = LoggerFactory.getLogger(XHandller.class);
	@Override
	public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
		ctx.flush();
	}

	@Override
	public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
		// 输出
		logger.info("开始方法调用" + msg.toString());
	}

	// 异常
	@Override
	public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
		cause.printStackTrace();
		ctx.close();
	}

}
